// import rq from 'request'
const {
  handleRequest
  // handleError,
  // handleSuccess
  // handleThrottle
} = require('../utils/handle')

const testCtrl = { test: {} }

testCtrl.test.GET = async (ctx) => {
  // rq({
  //   method: 'POST',
  //   url: 'http://www.stegd.edu.cn/selfec/login/login.do',
  //   form: {
  // _dc: '1531970616776',
  // account: '030418211324',
  // password: 'dada8520',
  // addcode: '6WB9',
  // devMode: 'false',
  // operate: 'login'
  //   },
  // headers: {
  //   'Content-Type': 'application/x-www-form-urlencoded'
  // },
  //   function (err, httpResponse, body) {
  //     console.log(err, httpResponse, body)
  //   }
  // })
  let result = await ctx.post('http://www.stegd.edu.cn/selfec/login/login.do', {
    _dc: '1531970616776',
    account: '030418211324',
    password: 'dada8520',
    addcode: 'gfaw',
    devMode: false,
    operate: 'login'
  }, {
    'Content-Type': 'application/x-www-form-urlencoded',
    'X-Requested-With': 'XMLHttpRequest',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'
  })
  console.log(result)
}

export default {
  test: ctx => handleRequest({ctx, controller: testCtrl.test})
}
